package Ms

//
//import (
//	"database/sql"
//	"encoding/json"
//	"fmt"
//	"db2s/dataDispos"
//	"db2s/global"
//	"runtime"
//	"strings"
//)
//
///*
//GetHotSqlText 在线获取热sql语句
//*/
//func (or QueryTable) GetHotSqlText(db map[string]*sql.DB, logThreadSeq int64) ([]map[string]interface{}, error) {
//	var (
//		event     = "[GetHotSqlText]"
//		tableData []map[string]interface{}
//		time      string
//		execTime  int64
//		err       error
//	)
//	pc, _, _, _ := runtime.Caller(1)
//	callingFunc := runtime.FuncForPC(pc)
//	callFile, callLine := callingFunc.FileLine(pc)
//	callFunc := callingFunc.Name()
//	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
//
//	if or.HotSqlBeginTime == "0" && or.HostSqlEndTime != "0" {
//		time = fmt.Sprintf("and t.LAST_LOAD_TIME <= to_date('%s','yyyy-mm-dd')", or.HostSqlEndTime)
//	} else if or.HotSqlBeginTime != "0" && or.HostSqlEndTime == "0" {
//		time = fmt.Sprintf("and t.LAST_LOAD_TIME >= to_date('%s','yyyy-mm-dd')", or.HotSqlBeginTime)
//	} else if or.HotSqlBeginTime != "0" && or.HostSqlEndTime != "0" {
//		time = fmt.Sprintf("and t.LAST_LOAD_TIME between to_date('%s','yyyy-mm-dd') and to_date('%s','yyyy-mm-dd')", or.HotSqlBeginTime, or.HostSqlEndTime)
//	}
//	strsql := fmt.Sprintf("select sql_id as \"sqlId\",sql_fulltext as \"sqlText\" from gv$sqlarea t where t.parsing_schema_name in ('%s') and t.command_type in (2,3,6,7)  %s", or.Schema, time)
//	vlog = fmt.Sprintf("(%d) %v %s begin exec a sql statement of table %s.%s. sql messige is {%s}", logThreadSeq, callFuncInfo, event, or.Schema, or.Table, strsql)
//	global.Wlog.Debug(vlog)
//	dispos := dataDispos.InstanceActiveS{DBType: DBType, DB: db["single"], StopTime: or.SqlExecStopTime}
//	var f1 any
//	if execTime, f1, err = dispos.SqlQuery(strsql, "sMap"); err != nil {
//		vlog = fmt.Sprintf("(%d) %v %v failed exec a sql statement of table %s.%s. sql is {%v},error is {%v}", or.LogThreadSeq, callFuncInfo, event, or.Schema, or.Table, strsql, err)
//		global.Wlog.Error(vlog)
//		return nil, err
//	}
//	if f1 != nil {
//		tableData = f1.([]map[string]interface{})
//	}
//	vlog = fmt.Sprintf("(%d) %v %s exec a sql statement of table %s.%s. sql messige is {%s}, exec timeOut is %v", or.LogThreadSeq, callFuncInfo, event, or.Schema, or.Table, strsql, execTime)
//	global.Wlog.Debug(vlog)
//	return tableData, err
//}
//
///*
//GetHotSqlElaptimePerms 获取热sql的执行次数
//*/
//func (or QueryTable) GetHotSqlElaptimePerms(db map[string]*sql.DB, logThreadSeq int64) ([]map[string]interface{}, error) {
//	var (
//		event     = "[GetHotSqlElaptimePerms]"
//		tableData []map[string]interface{}
//		execTime  int64
//		err       error
//	)
//	pc, _, _, _ := runtime.Caller(1)
//	callingFunc := runtime.FuncForPC(pc)
//	callFile, callLine := callingFunc.FileLine(pc)
//	callFunc := callingFunc.Name()
//	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
//
//	strsql := fmt.Sprintf("select sql_id as \"sqlId\",executions as \"executions\",round((elapsed_time/1000) / decode(executions, NULL, 1, 0, 1, executions),2) as \"elaptime_perms\" from gv$sqlarea where PARSING_SCHEMA_NAME in ('%s')", or.Schema)
//	vlog = fmt.Sprintf("(%d) %v %s begin exec a sql statement of table %s.%s. sql messige is {%s}", logThreadSeq, callFuncInfo, event, or.Schema, or.Table, strsql)
//	global.Wlog.Debug(vlog)
//	dispos := dataDispos.InstanceActiveS{DBType: DBType, DB: db["single"], StopTime: or.SqlExecStopTime}
//	var f1 any
//	if execTime, f1, err = dispos.SqlQuery(strsql, "sMap"); err != nil {
//		vlog = fmt.Sprintf("(%d) %v %v failed exec a sql statement of table %s.%s. sql is {%v},error is {%v}", or.LogThreadSeq, callFuncInfo, event, or.Schema, or.Table, strsql, err)
//		global.Wlog.Error(vlog)
//		return nil, err
//	}
//	if f1 != nil {
//		tableData = f1.([]map[string]interface{})
//	}
//	vlog = fmt.Sprintf("(%d) %v %s exec a sql statement of table %s.%s. sql messige is {%s}, exec timeOut is %v", or.LogThreadSeq, callFuncInfo, event, or.Schema, or.Table, strsql, execTime)
//	global.Wlog.Debug(vlog)
//	return tableData, err
//}
//
//func (or QueryTable) GetHotSqlVariable(db map[string]*sql.DB, sqlId string, logThreadSeq int64) ([]map[string]interface{}, error) {
//	var (
//		event     = "[GetHotSqlVariable]"
//		tableData []map[string]interface{}
//		execTime  int64
//		err       error
//	)
//	pc, _, _, _ := runtime.Caller(1)
//	callingFunc := runtime.FuncForPC(pc)
//	callFile, callLine := callingFunc.FileLine(pc)
//	callFunc := callingFunc.Name()
//	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
//
//	strsql := fmt.Sprintf("select CHILD_NUMBER as \"childNumber\", NAME as \"name\", POSITION as \"position\", DATATYPE_STRING as \"datatypeString\", VALUE_STRING as \"valueString\", sql_id as \"sqlId\"  from GV$SQL_BIND_CAPTURE where sql_id = '%s' and child_number = (select child_number from (select child_number from GV$SQL_BIND_CAPTURE where sql_id = '%s' order by last_captured desc, inst_id) where rownum <= 1) order by position", sqlId, sqlId)
//	vlog = fmt.Sprintf("(%d) %v %s begin exec a sql statement of table %s.%s. sql messige is {%s}", logThreadSeq, callFuncInfo, event, or.Schema, or.Table, strsql)
//	global.Wlog.Debug(vlog)
//	dispos := dataDispos.InstanceActiveS{DBType: DBType, DB: db["single"], StopTime: or.SqlExecStopTime}
//	var f1 any
//	if execTime, f1, err = dispos.SqlQuery(strsql, "sMap"); err != nil {
//		vlog = fmt.Sprintf("(%d) %v %v failed exec a sql statement of table %s.%s. sql is {%v},error is {%v}", or.LogThreadSeq, callFuncInfo, event, or.Schema, or.Table, strsql, err)
//		global.Wlog.Error(vlog)
//		return nil, err
//	}
//	if f1 != nil {
//		tableData = f1.([]map[string]interface{})
//	}
//	vlog = fmt.Sprintf("(%d) %v %s exec a sql statement of table %s.%s. sql messige is {%s}, exec timeOut is %v", or.LogThreadSeq, callFuncInfo, event, or.Schema, or.Table, strsql, execTime)
//	global.Wlog.Debug(vlog)
//	return tableData, err
//}
//func (or QueryTable) HotSqlPlayBack(_ map[string]*sql.DB, _ string, _ int64) map[string]string {
//	return nil
//}
//
///*
//QueryTableIndexColumnInfo 查询MySQL库下指定表的索引统计信息
//*/
//func (or QueryTable) QueryTableIndexColumnInfo(db *sql.DB, schema string, table []string) ([]global.IndexColumn, error) {
//	var (
//		event           = "[QueryTableIndexColumnInfo]"
//		tableJoin       string
//		indexColumnData []global.IndexColumn
//		execTime        int64
//		err             error
//	)
//	pc, _, _, _ := runtime.Caller(1)
//	callingFunc := runtime.FuncForPC(pc)
//	callFile, callLine := callingFunc.FileLine(pc)
//	callFunc := callingFunc.Name()
//	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
//
//	if len(table) > 0 {
//		tableJoin = fmt.Sprintf("and c.TABLE_NAME in ('%s') ", strings.Join(table, "','"))
//	}
//	strsql := fmt.Sprintf("select c.owner as \"databaseName\",c.TABLE_NAME as \"tableName\",c.COLUMN_NAME as \"columnName\",decode(c.DATA_TYPE,'DATE',c.data_type,c.DATA_TYPE || '(' || c.data_LENGTH || ')') as \"columnType\",decode(co.constraint_type, 'P', '1', '0') as \"columnKey\" ,i.UNIQUENESS as \"nonUnique\",i.DISTINCT_KEYS as \"cardinality\", ic.INDEX_NAME as \"indexName\", ic.COLUMN_POSITION as \"IndexSeq\", c.COLUMN_ID as \"columnSeq\" from all_tab_cols c inner join all_ind_columns ic on c.TABLE_NAME = ic.TABLE_NAME and c.OWNER = ic.table_owner and c.COLUMN_NAME = ic.COLUMN_NAME inner join all_indexes i on ic.table_owner = i.table_owner and ic.INDEX_NAME = i.INDEX_NAME and ic.TABLE_NAME = i.TABLE_NAME  left join all_constraints co on co.owner = c.owner   and co.table_name = c.table_name and co.index_name = i.index_name where c.OWNER in ('%s') %s AND C.VIRTUAL_COLUMN='NO' ORDER BY I.INDEX_NAME, ic.COLUMN_POSITION", schema, tableJoin)
//	dispos := dataDispos.InstanceActiveS{DBType: DBType, DB: db, StopTime: or.SqlExecStopTime}
//	var f1 any
//	if execTime, f1, err = dispos.SqlQuery(strsql, "sMap"); err != nil {
//		vlog = fmt.Sprintf("(%d) %v %v failed exec a sql statement of table %s.%s. sql is {%v},error is {%v}", or.LogThreadSeq, callFuncInfo, event, or.Schema, or.Table, strsql, err)
//		global.Wlog.Error(vlog)
//		return nil, err
//	}
//	vlog = fmt.Sprintf("(%d) %v %s exec a sql statement of table %s.%s. sql messige is {%s}, exec timeOut is %v", or.LogThreadSeq, callFuncInfo, event, or.Schema, or.Table, strsql, execTime)
//	global.Wlog.Debug(vlog)
//	if f1 != nil {
//		for _, v := range f1.([]map[string]interface{}) {
//			var dd = global.IndexColumn{}
//			jsonData, err1 := json.Marshal(v)
//			if err1 != nil {
//				global.Wlog.Error(fmt.Sprintf("(%d) %v %s map[string]interfacle strconv json fail. strconv data is %v error info is {%v}", or.LogThreadSeq, callFuncInfo, event, v, err1))
//				return nil, err1
//			}
//
//			// 反序列化JSON字符串到结构体
//			err = json.Unmarshal(jsonData, &dd)
//			if err != nil {
//				global.Wlog.Error(fmt.Sprintf("(%d) %v %s json strconv struct fail. strconv data is %v error info is {%v}", or.LogThreadSeq, callFuncInfo, event, jsonData, err1))
//				return nil, err
//			}
//			indexColumnData = append(indexColumnData, dd)
//		}
//	}
//	return indexColumnData, err
//}
//
///*
//IndexDisposF 根据Oracle库下指定表的索引信息，筛选主键索引、唯一索引、普通索引
//*/
//func (or QueryTable) IndexDisposF(queryData []map[string]interface{}, logThreadSeq int64) (map[string][]string, map[string][]string, map[string][]string) {
//	var (
//		nultiseriateIndexColumnMap            = make(map[string][]string)
//		multiseriateIndexColumnMap            = make(map[string][]string)
//		priIndexColumnMap                     = make(map[string][]string)
//		PriIndexCol, uniIndexCol, mulIndexCol []string
//		indexName                             string
//		currIndexName                         string
//		event                                 = "[IndexDisposF]"
//	)
//	pc, _, _, _ := runtime.Caller(1)
//	callingFunc := runtime.FuncForPC(pc)
//	callFile, callLine := callingFunc.FileLine(pc)
//	callFunc := callingFunc.Name()
//	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
//
//	vlog = fmt.Sprintf("(%d) %v %s Start to Classification primary key, unique index, ordinary index of the specified table %s.%s.", logThreadSeq, callFuncInfo, event, or.Schema, or.Table)
//	global.Wlog.Debug(vlog)
//	for _, v := range queryData {
//		currIndexName = fmt.Sprintf("%s", v["indexName"])
//		if !or.LowerCaseTableNames {
//			currIndexName = strings.ToUpper(fmt.Sprintf("%s", v["indexName"]))
//		}
//		//判断唯一索引（包含主键索引和普通索引）
//		if v["nonUnique"].(string) == "UNIQUE" {
//			if v["columnKey"].(string) == "1" {
//				if currIndexName != indexName {
//					indexName = currIndexName
//				}
//				PriIndexCol = append(PriIndexCol, fmt.Sprintf("%s", v["columnName"]))
//				priIndexColumnMap["pri"] = PriIndexCol
//			} else {
//				if currIndexName != indexName {
//					indexName = currIndexName
//					nultiseriateIndexColumnMap[indexName] = append(uniIndexCol, fmt.Sprintf("%s /*actions Column Type*/ %s", v["columnName"], v["columnType"]))
//				} else {
//					nultiseriateIndexColumnMap[indexName] = append(nultiseriateIndexColumnMap[indexName], fmt.Sprintf("%s /*actions Column Type*/ %s", v["columnName"], v["columnType"]))
//				}
//			}
//		}
//		//处理普通索引
//		if v["nonUnique"].(string) == "NONUNIQUE" {
//			if currIndexName != indexName {
//				indexName = currIndexName
//				multiseriateIndexColumnMap[indexName] = append(mulIndexCol, fmt.Sprintf("%s /*actions Column Type*/ %s", v["columnName"], v["columnType"]))
//			} else {
//				multiseriateIndexColumnMap[indexName] = append(multiseriateIndexColumnMap[indexName], fmt.Sprintf("%s /*actions Column Type*/ %s", v["columnName"], v["columnType"]))
//			}
//		}
//	}
//	vlog = fmt.Sprintf("(%d) %v %s Sorting completed of the table %s.%s. result is {pri:%v,unique:%v,index:%v}", logThreadSeq, callFuncInfo, event, or.Schema, or.Table, priIndexColumnMap, nultiseriateIndexColumnMap, multiseriateIndexColumnMap)
//	global.Wlog.Debug(vlog)
//	return priIndexColumnMap, nultiseriateIndexColumnMap, multiseriateIndexColumnMap
//}
//
///*
//ColumnvalueConvert sql where条件中包含特殊数据类型的转换
//*/
//func (or QueryTable) ColumnvalueConvert(TableColumn []map[string]string, cn, s string, _ int64) (d string) {
//	//处理oracle查询时间列时数据带时区问题  2021-01-23 10:16:29 +0800 CST
//	if strings.Contains(s, "'") {
//		s = strings.ReplaceAll(s, "'", "\\'")
//	} else {
//		s = fmt.Sprintf("'%s'", s)
//	}
//	for _, i := range TableColumn {
//		if strings.EqualFold(i["columnName"], cn) {
//			switch func(s string) (d string) {
//				if s == "DATE" {
//					d = "DATE"
//				}
//				if strings.Contains(s, "TIMESTAMP") {
//					d = "TIMESTAMP"
//				}
//				return
//			}(strings.ToUpper(i["dataType"])) {
//			case "DATE":
//				d = fmt.Sprintf("to_date(%s,'YYYY-MM-DD HH24:MI:SS')", s)
//			case "TIMESTAMP":
//				var jingdu string
//				if strings.Contains(i["dataType"], "(") && strings.Contains(i["dataType"], ")") {
//					l := strings.Split(i["dataType"], "(")[1]
//					jingdu = strings.Split(l, ")")[0]
//				}
//				if len(jingdu) > 0 {
//					d = fmt.Sprintf("to_timestamp(%s,'YYYY-MM-DD HH24:MI:SS.FF%s')", s, jingdu)
//				} else {
//					d = fmt.Sprintf("to_timestamp(%s,'YYYY-MM-DD HH24:MI:SS')", s)
//				}
//			default:
//				d = s
//			}
//			break
//		}
//	}
//	return
//}
//
///*
//ColumnvalueConvert 列数据根据数据类型进行转换
//*/
//func columnvalueConvert(TableColumn []global.TableMeta, cn, s string, logseq int64) (d string) {
//	var (
//		event      = "[ColumnvalueConvert]"
//		columnType string
//	)
//	pc, _, _, _ := runtime.Caller(1)
//	callingFunc := runtime.FuncForPC(pc)
//	callFile, callLine := callingFunc.FileLine(pc)
//	callFunc := callingFunc.Name()
//	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
//
//	olds := s
//	if strings.Contains(s, "'") {
//		s = strings.ReplaceAll(s, "'", "\\'")
//	} else {
//		s = fmt.Sprintf("'%s'", s)
//	}
//	if strings.EqualFold(cn, "rowId") {
//		return s
//	}
//	if strings.EqualFold(olds, "NULL") {
//		return olds
//	}
//	vlog = fmt.Sprintf("(%d) %v %v Column data single quote conversion. old value is {%v} new value is {%v}", logseq, callFuncInfo, event, olds, s)
//	global.Wlog.Debug(vlog)
//	for _, i := range TableColumn {
//		if strings.EqualFold(i.ColumnName, cn) {
//			switch func(s string) (d string) {
//				if s == "DATE" {
//					d = "DATE"
//				}
//				if strings.Contains(s, "TIMESTAMP") {
//					d = "TIMESTAMP"
//				}
//				return
//			}(strings.ToUpper(i.DataType)) {
//			//处理oracle查询时间列时数据带时区问题  2021-01-23 10:16:29 +0800 CST
//			case "DATE":
//				d = fmt.Sprintf("to_date(%s,'YYYY-MM-DD HH24:MI:SS')", s)
//				//处理oracle查询时间列时数据带时区问题  2021-01-23 10:16:29 +0800 CST
//			case "TIMESTAMP":
//				var jingdu string
//				if strings.Contains(i.DataType, "(") && strings.Contains(i.DataType, ")") {
//					l := strings.Split(i.DataType, "(")[1]
//					jingdu = strings.Split(l, ")")[0]
//				}
//				if len(jingdu) > 0 {
//					d = fmt.Sprintf("to_timestamp(%s,'YYYY-MM-DD HH24:MI:SS.FF%s')", s, jingdu)
//				} else {
//					d = fmt.Sprintf("to_timestamp(%s,'YYYY-MM-DD HH24:MI:SS')", s)
//				}
//			default:
//				d = s
//			}
//			break
//		}
//	}
//	vlog = fmt.Sprintf("(%d) %v %v Column type conversion. column old Name is {%v} column type value is {%v} column new name is {%v}", logseq, callFuncInfo, event, cn, columnType, d)
//	global.Wlog.Debug(vlog)
//	return
//}
//
//// ColumnDataTypeJudge 数据类型判断，是字符串还是数字
////func (or QueryTable) ColumnDataTypeJudge(cn string, logseq int64) (Type string) {
////	var (
////		event = "[ColumnDataTypeJudge]"
////	)
////	pc, _, _, _ := runtime.Caller(1)
////	callingFunc := runtime.FuncForPC(pc)
////	callFile, callLine := callingFunc.FileLine(pc)
////	callFunc := callingFunc.Name()
////	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
////	for _, v := range or.TableColumn {
////		if strings.EqualFold(v["columnName"], cn) {
////			switch strings.ToUpper(func(s1 string) (s string) {
////				if n := strings.Index(s1, "("); n != -1 {
////					s = s1[:n]
////				} else {
////					s = s1
////				}
////				return
////			}(v["dataType"])) {
////			case "INT", "NUMBER", "FLOAT", "INTEGER", "SMALLINT", "REAL", "BINARY_DOUBLE", "BINARY_FLOAT", "BINARY_INTEGER", "PLS_INTEGER", "NATURAL", "NATURALN", "POSITIVE", "POSITIVEN", "SIGNTYPE", "SIMPLE_INTEGER", "DECIMAL", "DEC", "NUMERIC":
////				Type = "int"
////			case "VARCHAR2", "CHAR", "NCHAR", "ROWID", "VARCHAR", "NVARCHAR2":
////				Type = "string"
////			case "SYSDATE", "DATE", "TIMESTAMP", "TIMESTAMP WITH TIME ZONE", "TIMESTAMP WITH LOCAL TIME ZONE":
////				Type = "datetime"
////			default:
////				Type = "string"
////			}
////			break
////		}
////	}
////	global.Wlog.Debug(fmt.Sprintf("(%v) %v %s The data type of column %v of table %v.%v is {%v}", logseq, callFuncInfo, event, cn, or.Schema, or.Table, Type))
////	return
////}
//
///*
//whereNullStitching where条件null值查询处理
//*/
////func whereNullStitching(where map[string]string, logseq int64) string {
////	var (
////		nullConstraint, nullDispos string
////		ok                         bool
////		event                      = "[whereNullStitching]"
////	)
////	pc, _, _, _ := runtime.Caller(1)
////	callingFunc := runtime.FuncForPC(pc)
////	callFile, callLine := callingFunc.FileLine(pc)
////	callFunc := callingFunc.Name()
////	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
////
////	vlog = fmt.Sprintf("(%d) %v %v begin dispos where null condition. dispos data is {%v}", logseq, callFuncInfo, event, where)
////	global.Wlog.Debug(vlog)
////	if nullConstraint, ok = where["nullConstraint"]; ok {
////		switch nullConstraint {
////		case "null":
////			nullDispos = fmt.Sprintf("\"%s\" is null or LENGTH(trim(\"%s\")) = 0", where["whereColumn"], where["whereColumn"])
////		case "not null":
////			nullDispos = fmt.Sprintf("\"%s\" is not null and LENGTH(trim(\"%s\")) > 0", where["whereColumn"], where["whereColumn"])
////		default:
////			nullDispos = ""
////		}
////	}
////	vlog = fmt.Sprintf("(%d) %v %v where null condition processing completed. result is {%v}", logseq, callFuncInfo, event, nullDispos)
////	global.Wlog.Debug(vlog)
////	return nullDispos
////}
//
///*
//whereLeftStitching 生成sql 语句where left 条件
//*/
////func whereLeftStitching(TableColumn []global.TableMeta, where map[string]string, logseq int64) string {
////	var (
////		columnDataLeft, querySymbolLeft string
////		cleftok, qleftok                = false, false
////		whereLeft                       string
////		event                           = "[whereLeftStitching]"
////	)
////	pc, _, _, _ := runtime.Caller(1)
////	callingFunc := runtime.FuncForPC(pc)
////	callFile, callLine := callingFunc.FileLine(pc)
////	callFunc := callingFunc.Name()
////	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
////
////	vlog = fmt.Sprintf("(%d) %v %v begin general sql where left condition.", logseq, callFuncInfo, event)
////	global.Wlog.Debug(vlog)
////	columnDataLeft, cleftok = where["columnDataLeft"]
////	querySymbolLeft, qleftok = where["querySymbolLeft"]
////	if cleftok && qleftok {
////		whereLeft = fmt.Sprintf("\"%s\" %s %s", where["whereColumn"], querySymbolLeft, columnvalueConvert(TableColumn, where["whereColumn"], columnDataLeft, logseq))
////	}
////	vlog = fmt.Sprintf("(%d) %v %v SQL where left condition generation is completed. result is {%v}.", logseq, callFuncInfo, event, whereLeft)
////	global.Wlog.Debug(vlog)
////	return whereLeft
////}
//
///*
//whereRightStitching 生成sql 语句where right 条件
//*/
////func whereRightStitching(TableColumn []global.TableMeta, where map[string]string, logseq int64) string {
////	var (
////		columnDataRight, querySymbolRight string
////		crightok, qrightok                = false, false
////		whereRight                        string
////		event                             = "[whereRightStitching]"
////	)
////	pc, _, _, _ := runtime.Caller(1)
////	callingFunc := runtime.FuncForPC(pc)
////	callFile, callLine := callingFunc.FileLine(pc)
////	callFunc := callingFunc.Name()
////	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
////
////	vlog = fmt.Sprintf("(%d) %v %v begin general sql where right condition.", logseq, callFuncInfo, event)
////	global.Wlog.Debug(vlog)
////	columnDataRight, crightok = where["columnDataRight"]
////	querySymbolRight, qrightok = where["querySymbolRight"]
////	if crightok && qrightok {
////		whereRight = fmt.Sprintf("\"%s\" %s %s", where["whereColumn"], querySymbolRight, columnvalueConvert(TableColumn, where["whereColumn"], columnDataRight, logseq))
////	}
////	vlog = fmt.Sprintf("(%d) %v %v SQL where right condition generation is completed. result is {%v}.", logseq, callFuncInfo, event, whereRight)
////	global.Wlog.Debug(vlog)
////	return whereRight
////}
//
///*
//sqlWhereLimit 生成sql语句的where条件
//*/
////func sqlWhereLimit(schema, table string, TableColumn []global.TableMeta, where map[string]string, logseq int64) (whereConditionSlice []string) {
////	var (
////		whereAdd, whereSql string
////		ok                 = false
////		event              = "[sqlWhereLimit]"
////	)
////	pc, _, _, _ := runtime.Caller(1)
////	callingFunc := runtime.FuncForPC(pc)
////	callFile, callLine := callingFunc.FileLine(pc)
////	callFunc := callingFunc.Name()
////	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
////
////	vlog = fmt.Sprintf("(%d) %v %v Start generating sql where statement of table %v.%v.", logseq, callFuncInfo, event, schema, table)
////	global.Wlog.Debug(vlog)
////	if v := whereNullStitching(where, logseq); len(v) > 0 {
////		whereConditionSlice = append(whereConditionSlice, v)
////	}
////	if v := whereLeftStitching(TableColumn, where, logseq); len(v) > 0 {
////		whereConditionSlice = append(whereConditionSlice, v)
////	}
////	if v := whereRightStitching(TableColumn, where, logseq); len(v) > 0 {
////		whereConditionSlice = append(whereConditionSlice, v)
////	}
////	if whereAdd, ok = where["whereAdd"]; !ok {
////		whereAdd = ""
////	} else {
////		if whereAdd != "" {
////			whereConditionSlice = append(whereConditionSlice, whereAdd)
////		}
////	}
////	if whereSql, ok = where["whereSql"]; ok {
////		vlog = fmt.Sprintf("(%d) %v %v Generate sql where statement completed of table %v.%v. result is {%v}", logseq, callFuncInfo, event, schema, table, whereSql)
////		global.Wlog.Debug(vlog)
////		return []string{whereSql}
////	}
////	vlog = fmt.Sprintf("(%d) %v %v Generate sql where statement completed of table %v.%v. result is {%v}", logseq, callFuncInfo, event, schema, table, whereConditionSlice)
////	global.Wlog.Debug(vlog)
////	return
////}
//
//// sqlWhereStitching  sql 语句where条件生成
////func sqlWhereStitching(schema, table string, TableColumn []global.TableMeta, where map[string]string, logseq int64) (whereConditionSlice []string) {
////	var (
////		whereAdd, whereSql string
////		ok                 = false
////		event              = "[sqlWhereStitching]"
////	)
////	pc, _, _, _ := runtime.Caller(1)
////	callingFunc := runtime.FuncForPC(pc)
////	callFile, callLine := callingFunc.FileLine(pc)
////	callFunc := callingFunc.Name()
////	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
////
////	vlog = fmt.Sprintf("(%d) %v %v Start generating sql where statement of table %v.%v.", logseq, callFuncInfo, event, schema, table)
////	global.Wlog.Debug(vlog)
////	if v := whereNullStitching(where, logseq); len(v) > 0 {
////		whereConditionSlice = append(whereConditionSlice, v)
////	}
////	if v := whereLeftStitching(TableColumn, where, logseq); len(v) > 0 {
////		whereConditionSlice = append(whereConditionSlice, v)
////	}
////	if v := whereRightStitching(TableColumn, where, logseq); len(v) > 0 {
////		whereConditionSlice = append(whereConditionSlice, v)
////	}
////	if whereAdd, ok = where["whereAdd"]; !ok {
////		whereAdd = ""
////	} else {
////		if whereAdd != "" {
////			whereConditionSlice = append(whereConditionSlice, whereAdd)
////		}
////	}
////	if whereSql, ok = where["whereSql"]; ok {
////		vlog = fmt.Sprintf("(%d) %v %v Generate sql where statement completed of table %v.%v. result is {%v}", logseq, callFuncInfo, event, schema, table, whereSql)
////		global.Wlog.Debug(vlog)
////		return []string{whereSql}
////	}
////	vlog = fmt.Sprintf("(%d) %v %v Generate sql where statement completed of table %v.%v. result is {%v}", logseq, callFuncInfo, event, schema, table, whereConditionSlice)
////	global.Wlog.Debug(vlog)
////	return
////}
//
///*
//sql 语句select 查询列生成。即 where语句前缀
//*/
////func sqlQueryColumnPer(m map[string]any) (columnName []string) {
////	var (
////		schema            string
////		table             string
////		column            string
////		tableColumn       []map[string]string
////		RowsActiveMapList map[string]string
////		esa               global.EncryptionProperties
////		esaColumn         = make(map[string]int)
////		logseq            int64
////		event             = "[sqlQueryColumnPer]"
////	)
////	pc, _, _, _ := runtime.Caller(1)
////	callingFunc := runtime.FuncForPC(pc)
////	callFile, callLine := callingFunc.FileLine(pc)
////	callFunc := callingFunc.Name()
////	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
////
////	if v, ok := m["schema"]; ok {
////		schema = fmt.Sprintf("%v", v)
////	}
////	if v, ok := m["table"]; ok {
////		table = fmt.Sprintf("%v", v)
////	}
////	if v, ok := m["tableColumn"]; ok {
////		tableColumn = v.([]map[string]string)
////	}
////	if v, ok := m["column"]; ok {
////		column = fmt.Sprintf("%v", v)
////	}
////
////	if v, ok := m["rowsDisposMapList"]; ok {
////		RowsActiveMapList = v.(map[string]string)
////	}
////	if v, ok := m["logseq"]; ok {
////		logseq = v.(int64)
////	}
////	if v, ok := m["esa"]; ok {
////		esa = v.(global.EncryptionProperties)
////	}
////	for _, v := range esa.ColumnSlice {
////		esaColumn[v]++
////	}
////
////	vlog = fmt.Sprintf("(%d) %v %v Start generating select query column prefixes of table %v.%v. input data is {%v}", logseq, callFuncInfo, event, schema, table, m)
////	global.Wlog.Debug(vlog)
////	for _, i := range tableColumn {
////		mu := "9"
////		nu := "0"
////		tmpcolumnName := fmt.Sprintf("\"%s\"", i["columnName"])
////		if strings.ToUpper(i["dataType"]) == "DATE" {
////			tmpcolumnName = fmt.Sprintf("to_char(%s,'YYYY-MM-DD HH24:MI:SS')", tmpcolumnName)
////		}
////		if strings.Contains(strings.ToUpper(i["dataType"]), "TIMESTAMP") {
////			var d int
////			if strings.Contains(i["dataType"], "(") && strings.Contains(i["dataType"], ")") {
////				var jingdu string
////				l := strings.Split(i["dataType"], "(")[1]
////				jingdu = strings.Split(l, ")")[0]
////				if len(jingdu) > 0 {
////					jingdu = strings.TrimSpace(jingdu)
////					if atoi, err2 := strconv.Atoi(jingdu); err2 == nil {
////						d = atoi
////					}
////				}
////			}
////			if d > 0 {
////				tmpcolumnName = fmt.Sprintf("to_char(%s,'YYYY-MM-DD HH24:MI:SS.FF%d')", tmpcolumnName, d)
////			} else {
////				tmpcolumnName = fmt.Sprintf("to_char(%s,'YYYY-MM-DD HH24:MI:SS')", tmpcolumnName)
////			}
////		}
////		if strings.HasPrefix(strings.ToUpper(i["dataType"]), "CHAR") {
////			tmpcolumnName = fmt.Sprintf("rtrim(%s)", tmpcolumnName)
////		}
////		if strings.HasPrefix(strings.ToUpper(i["dataType"]), "NUMBER(") {
////			dianAfter := strings.ReplaceAll(strings.Split(i["dataType"], ",")[1], ")", "")
////			bb, _ := strconv.Atoi(dianAfter)
////			dianBefer := strings.Split(strings.Split(i["dataType"], ",")[0], "(")[1]
////			bbc, _ := strconv.Atoi(dianBefer)
////			var tmpa, tmpb []string
////			for ii := 0; ii < bb; ii++ {
////				tmpa = append(tmpa, nu)
////			}
////			for ii := 1; ii < bbc-bb; ii++ {
////				tmpb = append(tmpb, mu)
////			}
////			if bb == 0 {
////				tmpcolumnName = fmt.Sprintf("to_char(%s,'FM%s0')", tmpcolumnName, strings.Join(tmpb, ""))
////			} else {
////				tmpcolumnName = fmt.Sprintf("to_char(%s,'FM%s0.%s')", tmpcolumnName, strings.Join(tmpb, ""), strings.Join(tmpa, ""))
////			}
////			if v1, ok := RowsActiveMapList[strings.ToLower("end0")]; ok && strings.EqualFold(v1, "true") {
////				tmpcolumnName = fmt.Sprintf("ltrim(rtrim(rtrim(%s, '0'),'.'), ' ')", tmpcolumnName)
////			}
////		}
////		if _, ok := esaColumn[i["columnName"]]; ok && len(esa.UnLockFuncName) > 0 {
////			tmpcolumnName = fmt.Sprintf("%v.%v(%v)", schema, esa.UnLockFuncName, tmpcolumnName)
////		}
////		if len(column) == 0 {
////			columnName = append(columnName, tmpcolumnName)
////		} else {
////			if strings.EqualFold(i["columnName"], column) {
////				columnName = append(columnName, tmpcolumnName)
////			}
////		}
////	}
////	vlog = fmt.Sprintf("(%d) %v %v Select query column prefix generation completed of table %v.%v. result is {%v}", logseq, callFuncInfo, event, schema, table, columnName)
////	global.Wlog.Debug(vlog)
////	return
////}
//
//// IndexColumnStartPartValue1 oracle库下查询表的索引列数据的始末位置，并进行去重排序
////func (or QueryTable) IndexColumnStartPartValue1(db map[string]*sql.DB, where map[string]string, Limitseq int64, selectColumn string, logseq int64) (EndRows map[string]interface{}, err error) {
////	var (
////		event       = "[IndexColumnStartPartValue1]"
////		execTimeout int64
////	)
////	pc, _, _, _ := runtime.Caller(1)
////	callingFunc := runtime.FuncForPC(pc)
////	callFile, callLine := callingFunc.FileLine(pc)
////	callFunc := callingFunc.Name()
////	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
////
////	vlog = fmt.Sprintf("(%d) %v %s Start querying the beginning and end value of the index column of table %s.%s.", logseq, callFuncInfo, event, or.Schema, or.Table)
////	global.Wlog.Debug(vlog)
////	Limitseq1 := Limitseq + 1
////	var scnsql string
////	if !strings.EqualFold(or.Scn, "0") && len(or.Scn) > 0 {
////		scnsql = fmt.Sprintf(" AS OF SCN %v ", or.Scn)
////	}
////	strsql := fmt.Sprintf("select * from (select t.*,rownum rn from (select %s as \"columnName\" from \"%s\".\"%s\" %v where %s order by \"%s\") t where rownum<=%d) where rn>%d", strings.Join(sqlQueryColumnPer(map[string]any{
////		"schema":            or.Schema,
////		"table":             or.Table,
////		"tableColumn":       or.TableColumn,
////		"rowsDisposMapList": or.RowsActiveMapList,
////		"column":            selectColumn,
////		"logseq":            logseq,
////	}), ","), or.Schema, or.Table, scnsql, strings.Join(sqlWhereLimit(or.Schema, or.Table, or.TableColumn, where, logseq), " and "), selectColumn, Limitseq1, Limitseq)
////	dispos := dataDispos.DBdataDispos{DBType: DBType, DB: db["single"], StopTime: or.SqlExecStopTime}
////	var f1 any
////	if execTimeout, f1, err = dispos.SqlQuery(strsql, "map"); err != nil {
////		vlog = fmt.Sprintf("(%d) %v %v The execution of a sql statement failed. sql is {%v},error is {%v}", logseq, callFuncInfo, event, strsql, err)
////		global.Wlog.Error(vlog)
////		return nil, err
////	}
////	if f1 != nil {
////		EndRows = f1.(map[string]interface{})
////	}
////	vlog = fmt.Sprintf("(%d) %v %v A sql statement was executed successfully. sql is {%v}, exec timeout is {%vms}", logseq, callFuncInfo, event, strsql, execTimeout)
////	global.Wlog.Debug(vlog)
////	return
////}
//
////func (or QueryTable) IndexColumnPartQuryGroupCount1(_ map[string]*sql.DB, _ map[string]string, _ string, _ int64) (D int64, err error) {
////	return D, nil
////}
//
///*
//TableRows oracle 查询表的统计信息中行数
//*/
////func (or QueryTable) TableRows(db map[string]*sql.DB, logseq int64) (uint64, error) {
////	var (
////		event       = "[TableRows]"
////		tableData   map[string]interface{}
////		rowsCount   uint64
////		execTimeout int64
////		err         error
////	)
////	pc, _, _, _ := runtime.Caller(1)
////	callingFunc := runtime.FuncForPC(pc)
////	callFile, callLine := callingFunc.FileLine(pc)
////	callFunc := callingFunc.Name()
////	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
////
////	vlog = fmt.Sprintf("(%d) %v %s Query the number of table rows for statistical information of table %v.%v", logseq, callFuncInfo, event, or.Schema, or.Table)
////	global.Wlog.Debug(vlog)
////
////	dispos := dataDispos.DBdataDispos{DBType: DBType, DB: db["single"], StopTime: or.SqlExecStopTime}
////	//收集统计信息
////	strsql := fmt.Sprintf("select num_rows as \"tableRows\" from all_tables where owner='%s' and table_name='%s'", or.Schema, or.Table)
////	var f1 any
////	if execTimeout, f1, err = dispos.SqlQuery(strsql, "map"); err != nil {
////		vlog = fmt.Sprintf("(%d) %v %v The execution of a sql statement failed. sql is {%v},error is {%v}", logseq, callFuncInfo, event, strsql, err)
////		global.Wlog.Error(vlog)
////		return 0, err
////	}
////	vlog = fmt.Sprintf("(%d) %v %v A sql statement was executed successfully. sql is {%v}, exec timeout is {%vms}", logseq, callFuncInfo, event, strsql, execTimeout)
////	global.Wlog.Debug(vlog)
////	if f1 != nil {
////		if len(tableData) > 0 {
////			if rowsCount, err = strconv.ParseUint(fmt.Sprintf("%s", tableData["tableRows"]), 10, 64); err != nil {
////				vlog = fmt.Sprintf("(%d) %v %s Table row count conversion failed. data is %s, error is %s", logseq, callFuncInfo, event, tableData["tableRows"], err)
////				global.Wlog.Error(vlog)
////				rowsCount = 0
////			}
////		} else {
////			rowsCount = 0
////		}
////	}
////	vlog = fmt.Sprintf("(%d) %v %s The row number query of table a is successful. result is {%v}", logseq, callFuncInfo, event, rowsCount)
////	global.Wlog.Debug(vlog)
////	return rowsCount, nil
////}
////func (or QueryTable) TableCount(db *sql.DB, logseq int64) (uint64, error) {
////	var (
////		event          = "[TableCount]"
////		tableData      map[string]interface{}
////		rowsCount      uint64
////		execTimeout    int64
////		err            error
////		queryTableName string
////	)
////	pc, _, _, _ := runtime.Caller(1)
////	callingFunc := runtime.FuncForPC(pc)
////	callFile, callLine := callingFunc.FileLine(pc)
////	callFunc := callingFunc.Name()
////	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
////
////	dispos := dataDispos.DBdataDispos{DBType: DBType, DB: db, StopTime: or.SqlExecStopTime}
////	vlog = fmt.Sprintf("(%d) %v %s Query the actual number of rows in table %v.%v", logseq, callFuncInfo, event, or.Schema, or.Table)
////	global.Wlog.Debug(vlog)
////	queryTableName = fmt.Sprintf(" \"%v\".\"%v\" ", strings.ToUpper(or.Schema), or.Table)
////	if len(or.PartitionName) > 0 {
////		if !strings.EqualFold(or.PartitionName, "single") {
////			queryTableName = fmt.Sprintf(" \"%v\".\"%v\" PARTITION(%v)", strings.ToUpper(or.Schema), or.Table, or.PartitionName)
////		}
////	}
////	//收集统计信息
////	var strsql string
////	if !strings.EqualFold(or.Scn, "0") && len(or.Scn) > 0 {
////		strsql = fmt.Sprintf("select /*+ parallel(16) */ count(1) as \"tableRows\" from %v AS OF SCN %v", queryTableName, or.Scn)
////	} else {
////		strsql = fmt.Sprintf("select /*+ parallel(16) */ count(1) as \"tableRows\" from %v", queryTableName)
////	}
////	var f1 any
////	if execTimeout, f1, err = dispos.SqlQuery(strsql, "map"); err != nil {
////		vlog = fmt.Sprintf("(%d) %v %v The execution of a sql statement failed. sql is {%v},error is {%v}", logseq, callFuncInfo, event, strsql, err)
////		global.Wlog.Error(vlog)
////		return 0, err
////	} else {
////		tableData = f1.(map[string]interface{})
////	}
////	vlog = fmt.Sprintf("(%d) %v %v A sql statement was executed successfully. sql is {%v}, exec timeout is {%vms}", logseq, callFuncInfo, event, strsql, execTimeout)
////	global.Wlog.Debug(vlog)
////	if f1 != nil {
////		if len(tableData) > 0 {
////			if rowsCount, err = strconv.ParseUint(fmt.Sprintf("%s", tableData["tableRows"]), 10, 64); err != nil {
////				vlog = fmt.Sprintf("(%d) %v %s Table row count conversion failed. data is %s, error is %s", logseq, callFuncInfo, event, tableData["tableRows"], err)
////				global.Wlog.Error(vlog)
////				rowsCount = 0
////			}
////		} else {
////			rowsCount = 0
////		}
////	}
////	vlog = fmt.Sprintf("(%d) %v %s The row number query of table a is successful. result is {%v}", logseq, callFuncInfo, event, rowsCount)
////	global.Wlog.Debug(vlog)
////	return rowsCount, nil
////}
////func (or QueryTable) TableTruncate(_ map[string]*sql.DB, _ int64) bool {
////	return true
////}
////func (or QueryTable) NoIndexGeneratingQueryCriteria(db map[string]*sql.DB, logseq int64) (sc chan *string, err error) {
////	var (
////		event          = "[NoIndexGeneratingQueryCriteria]"
////		strsql         string
////		execTimeout    int64
////		queryTableName string
////	)
////	pc, _, _, _ := runtime.Caller(1)
////	callingFunc := runtime.FuncForPC(pc)
////	callFile, callLine := callingFunc.FileLine(pc)
////	callFunc := callingFunc.Name()
////	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
////	vlog = fmt.Sprintf("(%d) %v %s Start executing the full data query of table %v.%v without index", logseq, callFuncInfo, event, or.Schema, or.Table)
////	global.Wlog.Debug(vlog)
////
////	queryColumn := strings.Join(sqlQueryColumnPer(map[string]any{
////		"schema":            or.Schema,
////		"table":             or.Table,
////		"tableColumn":       or.TableColumn,
////		"rowsDisposMapList": or.RowsActiveMapList,
////		"column":            "",
////		"logseq":            logseq,
////		"esa":               or.Eas,
////	}), ",")
////	var sqlWhereHasSuffix string
////	queryTableName = fmt.Sprintf(" \"%v\".\"%v\" ", strings.ToUpper(or.Schema), or.Table)
////	if len(or.PartitionName) > 0 {
////		if !strings.EqualFold(or.PartitionName, "single") {
////			queryTableName = fmt.Sprintf(" \"%v\".\"%v\" PARTITION(%v)", strings.ToUpper(or.Schema), or.Table, or.PartitionName)
////		}
////	}
////	if !strings.EqualFold(or.Scn, "0") && len(or.Scn) > 0 {
////		sqlWhereHasSuffix = fmt.Sprintf(" %s from %v AS OF SCN %v", queryColumn, queryTableName, or.Scn)
////	} else {
////		sqlWhereHasSuffix = fmt.Sprintf(" %s from %v ", queryColumn, queryTableName)
////	}
////	if len(or.MissIndexTablePx) > 0 {
////		strsql = fmt.Sprintf("select /*+ parallel(%s) */ %v ", or.MissIndexTablePx, sqlWhereHasSuffix)
////	} else {
////		strsql = fmt.Sprintf("select %v ", sqlWhereHasSuffix)
////	}
////	dispos := dataDispos.DBdataDispos{DBType: DBType, DB: db["single"], StopTime: or.SqlExecStopTime, FixRows: or.FixRows}
////	var entry any
////	if execTimeout, entry, err = dispos.SqlQuery(strsql, "chanS"); err != nil {
////		vlog = fmt.Sprintf("(%d) %v %v The execution of a sql statement failed. sql is {%v},error is {%v}", logseq, callFuncInfo, event, strsql, err)
////		global.Wlog.Error(vlog)
////		return nil, err
////	}
////	if entry != nil {
////		sc = entry.(chan *string)
////	}
////	vlog = fmt.Sprintf("(%d) %v %v A sql statement was executed successfully. sql is {%v}, exec timeout is {%vms}", logseq, callFuncInfo, event, strsql, execTimeout)
////	global.Wlog.Debug(vlog)
////	return
////}
//
///*
//GeneratingQueryCriteria Oracle 通过where条件查询表的分段数据（查询数据生成带有greatdbCheck标识的数据块）
//*/
////func (or QueryTable) GeneratingQueryCriteria(db map[string]*sql.DB, sqlwhere string, logseq int64) (any, error) {
////	var (
////		event       = "[GeneratingQueryCriteria]"
////		execTimeout int64
////		err         error
////	)
////	pc, _, _, _ := runtime.Caller(1)
////	callingFunc := runtime.FuncForPC(pc)
////	callFile, callLine := callingFunc.FileLine(pc)
////	callFunc := callingFunc.Name()
////	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
////
////	vlog = fmt.Sprintf("(%d) %v %s Start querying the block data of index table %s.%s.", logseq, callFuncInfo, event, or.Schema, or.Table)
////	global.Wlog.Debug(vlog)
////	dispos := dataDispos.DBdataDispos{DBType: DBType, DB: db["single"], StopTime: or.SqlExecStopTime}
////	var f1 any
////	if execTimeout, f1, err = dispos.SqlQuery(sqlwhere, "[]string"); err != nil {
////		vlog = fmt.Sprintf("(%d) %v %v The execution of a sql statement failed. sql is {%v},error is {%v}", logseq, callFuncInfo, event, sqlwhere, err)
////		global.Wlog.Error(vlog)
////		return nil, err
////	}
////	vlog = fmt.Sprintf("(%d) %v %v A sql statement was executed successfully. sql is {%v}, exec timeout is {%vms}", logseq, callFuncInfo, event, sqlwhere, execTimeout)
////	global.Wlog.Debug(vlog)
////	return f1, nil
////}
//
///*
//GeneratingQuerySql Oracle 生成查询数据的sql语句
//*/
////func (or QueryTable) GeneratingQuerySql(where map[string]string, logseq int64) (string, error) {
////	var (
////		event     = "[GeneratingQuerySql]"
////		selectSql string
////	)
////	pc, _, _, _ := runtime.Caller(1)
////	callingFunc := runtime.FuncForPC(pc)
////	callFile, callLine := callingFunc.FileLine(pc)
////	callFunc := callingFunc.Name()
////	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
////	vlog = fmt.Sprintf("(%d) %v %s Start generating block data query sql for index table %v.%v", logseq, callFuncInfo, event, or.Schema, or.Table)
////	global.Wlog.Debug(vlog)
////	queryColumn := strings.Join(sqlQueryColumnPer(map[string]any{
////		"schema":            or.Schema,
////		"table":             or.Table,
////		"tableColumn":       or.TableColumn,
////		"rowsDisposMapList": or.RowsActiveMapList,
////		"column":            "",
////		"logseq":            logseq,
////		"esa":               or.Eas,
////	}), ",/*column Splict*/")
////	whereSql := sqlWhereStitching(or.Schema, or.Table, or.TableColumn, where, logseq)
////	orderBy, ok := where["whereColumn"]
////	var sqlWherePerfix string
////	if !strings.EqualFold(or.Scn, "0") && len(or.Scn) > 0 {
////		sqlWherePerfix = fmt.Sprintf("select %s from \"%s\".\"%s\" AS OF SCN %v", queryColumn, strings.ToUpper(or.Schema), or.Table, or.Scn)
////	} else {
////		sqlWherePerfix = fmt.Sprintf("select %s from \"%s\".\"%s\" ", queryColumn, strings.ToUpper(or.Schema), or.Table)
////	}
////	if ok {
////		selectSql = fmt.Sprintf(" %v where %s order by \"%s\"", sqlWherePerfix, strings.Join(whereSql, " and "), orderBy)
////		//		selectSql = fmt.Sprintf("select %s from \"%s\".\"%s\" where %s order by \"%s\"", queryColumn, strings.ToUpper(or.Schema), or.Table, strings.Join(whereSql, " and "), orderBy)
////	} else {
////		selectSql = fmt.Sprintf(" %v where %s", sqlWherePerfix, strings.Join(whereSql, " and "))
////		//		selectSql = fmt.Sprintf("select %s from \"%s\".\"%s\" where %s", queryColumn, strings.ToUpper(or.Schema), or.Table, strings.Join(whereSql, " and "))
////	}
////	vlog = fmt.Sprintf("(%d) %v %v Block data query sql generation of index table %v.%v is completed. result is {%v}", logseq, callFuncInfo, event, or.Schema, or.Table, selectSql)
////	global.Wlog.Debug(vlog)
////	return selectSql, nil
////}
//
////func (or QueryTable) GeneratingEncryptionQuerySql(sqlS string, EncryptionAlgorithm string, logseq int64) (selectSql string) {
////	var (
////		event = "[GeneratingEncryptionQuerySql]"
////	)
////	pc, _, _, _ := runtime.Caller(1)
////	callingFunc := runtime.FuncForPC(pc)
////	callFile, callLine := callingFunc.FileLine(pc)
////	callFunc := callingFunc.Name()
////	callFuncInfo := fmt.Sprintf("Call functions %v Call File %v:%v", callFunc, callFile, callLine)
////
////	vlog = fmt.Sprintf("(%d) %v %s Start generating fast data query encrypted sql for index table %v.%v", logseq, callFuncInfo, event, or.Schema, or.Table)
////	global.Wlog.Debug(vlog)
////	if sqlS != "" {
////		fromS := strings.Split(sqlS, "from")
////		selectS := strings.Split(fromS[0], "select")
////		columnS := strings.Join(strings.Split(selectS[1], ",/*column Splict*/"), "||'g'||")
////		selectSql = fmt.Sprintf("select %s(trim(',' from XMLAGG(XMLELEMENT(E,%s(%s), ',')).EXTRACT('//text()').getclobVal())) as \"md5\",count(1) as \"count\" from %s", EncryptionAlgorithm, EncryptionAlgorithm, columnS, fromS[1])
////	}
////	vlog = fmt.Sprintf("(%d) %v %v The fast data query encrypted sql for index table %v.%v is generated. result is {%v}", logseq, callFuncInfo, event, or.Schema, or.Table, selectSql)
////	global.Wlog.Debug(vlog)
////	return selectSql
////}
////func (or QueryTable) CountIndexCheck(db map[string]*sql.DB) (dd uint64, mqSwitch bool) {
////	var err error
////	if dd, err = or.TableCount(db["single"], 1); err != nil {
////		fmt.Println(err)
////	}
////	return
////}
